#ifndef __TINYSRV_COND_VAR_H__
#define __TINYSRV_COND_VAR_H__

#include "non_copyable.h"
#include "exception.h"

#include <pthread.h>

namespace tinySrv
{

  DECLARE_TINYSRV_EXCEPTION(CondVar)
  
  class CondVar
    : private NonCopyable
  {
  public:
    CondVar();
    ~CondVar();
    void Alarm();
    void AlarmForAll();
    void Wait();
    bool WaitTimeout(unsigned long timeout);
      
  private:
    pthread_mutex_t Mtx;
    pthread_cond_t Cond;
  };
  
}
    
#endif  // !__TINYSRV_COND_VAR_H__
